home *** CD-ROM | disk | FTP | other *** search
- /*
- Remove remarks of a Shell or equivalent script (e.g. BareED.cfg)
- Updated: 6-Apr-2001
- */
-
- BAREED_HOST = GetClip('BAREED')
-
- IF BAREED_HOST = '' THEN DO
- CALL SetClip('BAREED') /* Remove from ClipNode */
- EXIT 5
- END
-
- ADDRESS VALUE BAREED_HOST
-
- CALL SetClip('BAREED') /* Remove from ClipNode */
-
- OPTIONS RESULTS
-
- /* ---------------------- MAIN --------------------- */
-
- casetell "WARNING" '0a'x '0a'x "Going to remove remarks off Shell scripts or" '0a'x "assembler source files." '0a'x '0a'x "Sure to go ahead?"
- IF RESULT == 0 THEN
- EXIT
-
- set findmode
- set find string ";"
-
- terminate = 0
-
- /* Delete remarks */
- DO WHILE terminate == 0 /* As long as we find the string */
- find next string
- terminate = RC
- IF RC ~= 0 THEN
- BREAK /* In case not found */
-
- move cursor left /* Get character left of semicolon */
- get current char
- thischar = C2D(RESULT)
- move cursor right /* Move to semicolon */
- cont = 1
-
- IF thischar == 9 | thischar == 32 | thischar == 10 /* Left char of semicolon should be: tab, space or linefeed */
- THEN delete to lineend /* ...then, we'll remove all - starting with the semicolon to lineend */
- ELSE DO
- cont = 0
- END
-
- IF cont ~= 0 THEN DO /* Remark removed? */
- DO WHILE cont /* ...yes */
- move cursor left /* One position to the left */
- get current char /* Get the char code */
- thischar = C2D(RESULT)
- IF thischar == 9 | thischar == 32 /* Remove also the char left of (removed) semicolon */
- THEN delete current char /* ...if it is a tab or space character */
- ELSE DO
- cont = 0
- END
- END
- END
-
- END
-
- terminate = 0
-
- set find string '0a'x||"*" /* Remove a line if it begins with a asterisk */
- move cursor archivestart /* Start at archive's start */
- DO WHILE terminate == 0
- find next string
- terminate = RC
- IF RC ~= 0 THEN
- BREAK
- move cursor right /* first character (*) in line */
- delete current line
- move cursor left /* Two steps back */
- move cursor left
- END
-
- set find string '0a'x||'0a'x /* Remove paragraphs (double used linefeeds) */
- set replace string '0a'x
- move cursor archivestart
- replace all
-
- /* Delete first line of file if it is a remark */
- move cursor archivestart
- get current char
- IF RESULT == ";" | RESULT == "*" THEN
- delete current line
-